println("params: ${params}")
def isParamsInProjectName = currentBuild.projectName.endsWith(")")
def paramsInProjectName = currentBuild.projectName.find(/\(([^\)]+)\)/, {group -> group[1]})
def nodeName = isParamsInProjectName ? paramsInProjectName.split(',')[0].trim() : params.NODE_NAME
def env = isParamsInProjectName ? paramsInProjectName.split(',')[1].trim() : params.ENV

node(nodeName) {

    // checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'jcyy_svn_credential', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'http://114.55.64.147/svn/rbm/trunk']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
    checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'jcyy_svn_credential', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'http://114.55.64.147/svn/mdm/trunk']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])

//    def build = load 'jenkins/deploy-scripts/angularClientBuild.groovy'

//    build.build(env)

    dir('console-website') {
//            sh 'npm --registry https://registry.npm.taobao.org install'
        sh 'npm --registry https://registry.npm.taobao.org install'
        sh "grunt build:${env} --force"
    }

    archiveArtifacts "console-website/zip/mdm_${env}_client.zip"
}